package Utils;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

public class Tools {
    public static List<String> GetAllFilePath(String directoryPath){
        /**
         * 获取directoryPath，所有文件的绝对路径
         */
        List<String> list = new ArrayList<>();
        File baseFile = new File(directoryPath);

        if (baseFile.isFile() || !baseFile.exists())
            return list;

        File[] files = baseFile.listFiles();
        for (File file : files){
            if (file.isDirectory())
                list.addAll(GetAllFilePath(file.getAbsolutePath()));
            else
                list.add(file.getAbsolutePath());
        }

        return list;
    }
}
